/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package group2assignone.ucm.manager;

import group2assignone.dao.MyDAO;
import group2assignone.model.Airport;
import group2assignone.ucm.UCController;
import group2assignone.ucm.UCStartup;
import group2assignone.view.manager.*;
import java.util.ArrayList;

/**
 * Use Case: Change UI to Delete Airport View                               <br>
 * Pre-condition: Manager is logged in and clicks the 'delete airport' button. <br>
 * Post-condition: Delete airport view is displayed                            <br>
 * 1. System exits the current view                                         <br>
 * 2. System retrieves all current airports.                                <br>
 * 3. System displays available airports in the delete airport view         <br>

 * @author group2
 */

public class UCUIDeleteAirport implements UCController
{
     ArrayList<Airport> airportList = new ArrayList<Airport>();

    /**
    * use case to change UI to delete airport view
    */
    public void run()
    {
        //1. system exits the current view
        ManagerView mv = ManagerView.getInstance();
        mv.dispose();
        //2. System retrieves all current airports.
        MyDAO coms = UCStartup.getInstance().getDAO();
        airportList = coms.sQLGetAirports();
        //3. System displays available airports in the delete airport view
        DeleteAirportView view = new DeleteAirportView(airportList);
        view.go();

    }

}
